import baseService from '../baseService/index.js'
import {responseInterceptor} from './interceptor/index.js'

// 发送消息
const sendMessageApi = async (params)=>{
    try{
        let res = await baseService.post("/sendMessage",params)
        return responseInterceptor(res,'body')
    }catch(err){
        console.log('未知异常---',err)
        alert('未知异常')
    }
}


// 保存消息
const saveMessageApi = async (params)=>{
    try{
        let res = await baseService.post("/saveMessage",params)
        return responseInterceptor(res)
    }catch(err){
        console.log('未知异常---',err)
        alert('未知异常')
    }
}

// 查询消息
const searchConversitionListApi = async (params)=>{
     try{
        let res = await baseService.post("/searchConversitionList",params)
        return responseInterceptor(res)
    }catch(err){
        console.log('未知异常---',err)
        alert('未知异常')
    }
}

// 删除历史会话
const deleteHistoryConversitionApi = async (params)=>{
     try{
        let res = await baseService.post("/deleteHistoryConversition",params)
        return responseInterceptor(res)
    }catch(err){
        console.log('未知异常---',err)
        alert('未知异常')
    }



}

export {
    sendMessageApi,
    saveMessageApi,
    searchConversitionListApi,
    deleteHistoryConversitionApi
}